
var num = -1;
var status = $('#status').val();
if(status == "0"){            
  ds.dialog({
    title : '&#25805;&#20316;&#25552;&#31034;',
    content : '&#27963;&#21160;&#23578;&#26410;&#24320;&#22987;&#21734;',
    yesText : '&#30830;&#23450;',
      timeout :2.5,
  });
  return false;
}
if(status == "2"){              
  ds.dialog({
    title : '&#25805;&#20316;&#25552;&#31034;',
    content : '&#27963;&#21160;&#24050;&#32463;&#32467;&#26463;&#21862;',
    yesText : '&#30830;&#23450;',
      timeout :2.5,
  });
  return false;
}
{if (!empty($myworker) && $myworker['level']<=3 && empty($config['isworkerpay']))}
{if $config['isxianxia']>0}
{php $xianxiatips = '&#44;&#22914;&#38656;&#24110;&#23458;&#25143;&#19979;&#21333;&#35831;&#29992;&#32447;&#19979;&#24405;&#20837;';}
{/if}
  ds.dialog({
    title : '&#25805;&#20316;&#25552;&#31034;',
    content : '&#21592;&#24037;&#19981;&#21487;&#20197;&#25253;&#21517;&#44;&#22914;&#38656;&#27979;&#35797;&#35831;&#29992;&#38750;&#21592;&#24037;&#24494;&#20449;{$xianxiatips}',
    yesText : '&#30830;&#23450;',
      timeout :5,
  });
  return false;
{/if}

{if $system['gift']==1}

      var prizes = [];
      $('.select_prize_id:checked').each(function(){
          prizes.push($(this).val());
      });
      // 记录礼品数量信息
      var prizes_arr = [];
      prizes_arr[0] = {$config['gifttypeselect2']};
      prizes_arr[1] = {$config['gifttypeselect1']};

      if(prizes.length < 1){
        ds.dialog({
           title : '&#25805;&#20316;&#25552;&#31034;',
           content : '&#35831;&#36873;&#25321;{$config['address']}',
           yesText : '&#30830;&#23450;',
             timeout :2.5,
        });
        return false;
        }
      {if $config['typeid'] == 0}
          if(prizes_arr[0] > 0){
            if(prizes.length > prizes_arr[0]){
              ds.dialog({
                title : '&#25805;&#20316;&#25552;&#31034;',
                content : '&#27492;&#27963;&#21160;&#26368;&#22810;&#21482;&#33021;&#36873;&#25321;' + prizes_arr[0] + '&#39033;',
                yesText : '&#30830;&#23450;',
                  timeout :2.5,
              });
              return false;
            }else if(prizes.length < prizes_arr[1]){
              ds.dialog({
                title : '&#25805;&#20316;&#25552;&#31034;',
                content : '&#27492;&#27963;&#21160;&#26368;&#23569;&#38656;&#35201;&#36873;&#25321;' + prizes_arr[1] + '&#39033;',
                yesText : '&#30830;&#23450;',
                  timeout :2.5,
              });
              return false;
            }
          }
      {/if}
      
{/if}
      

{if $isyixuan == true}             
  ds.dialog({
    title : '&#25805;&#20316;&#25552;&#31034;',
    content : '&#23458;&#25143;&#27963;&#21160;&#36827;&#34892;&#20013;&#44;&#19981;&#21487;&#27979;&#35797;',
    yesText : '&#30830;&#23450;',
      timeout :2.5,
  });
  return false;
{/if}

var address = '';
{if $system['gift']==1 || $system['isboxgift']==1}
    var address = prizes;
    if (address.length<=0){
        var address = $('#address option:selected').val();
    }
{else}
    if (addresstype == 2){
        address = $('#address option:selected').val();
    }else if (addresstype == 3) {
        $(".cur").each(function () {
            address = address + $(this).html() + '|';
        })
        address = address.replace(new RegExp('&nbsp;','g'),"");
    }else{
        address = $("#address").val();
    }
{/if}

var option='';
if (shopstype == 0) {
  option = $('#shops option:selected').val();
}else if (shopstype == 4) {
  $(".on").each(function(){
    option=option+ $(this).html()+'|';
  })
  option='{php echo empty($config['gudingoptions'])?'':implode("|",$config['gudingoptions'])."|";}'+option;
}else if (shopstype == 3) {
    $(".cur").each(function () {
        option = option + $(this).html() + '|';
    })
    option = option.replace(new RegExp('&nbsp;','g'),"");
}else if (shopstype == 8) {
    $(".on").each(function(){
    option+= $(this).data("pid")+",";
    })
    let dx_default_selected = $('.default_selected');
    if(dx_default_selected.length>0){
        for (let k =0; k<dx_default_selected.length; k++){
            option+= $('.default_selected').eq(k).data("pid")+",";
        }
    }
}else{
  option = $("#shops").val();
}
var formtwo = '';
if (formtwotype == 2){
    formtwo = $('#formtwo option:selected').val();
}else if (formtwotype == 3) {
    $(".cur").each(function () {
        formtwo = formtwo + $(this).html() + '|';
    })
    formtwo = formtwo.replace(new RegExp('&nbsp;','g'),"");
}else{
    formtwo = $("#formtwo").val();
}

var jiagetype = $('#jiagetype option:selected').val();
var code = $('#code option:selected').val();
var datetime = $("#datetime").val();
var addinfo = $("#addinfo").val();
var xieyi =  $('#xieyi').is(':checked');

var checkid = $("#check_type").val();
if(checkid == undefined || checkid == 0){
    ds.dialog({
        title : '&#25805;&#20316;&#25552;&#31034;',
        content : '&#35831;&#36873;&#25321;&#19968;&#31181;&#21442;&#19982;&#26041;&#24335;！',
        yesText : '&#30830;&#23450;',
        timeout :2.5,
    });
    return false;
}else if(checkid == 1){
    var joinidv = 0;
}else if(checkid == 3){
    var joinidv = 9;
}else if(checkid == 4 || checkid == 5 || checkid == 8 || checkid == 101 || checkid == 102 || checkid == 103){
    var joinidv = checkid;
}else{
    var joinidv = 1;
}


var username = $('#username_order').val();
var mobile = $("#mobile_order").val();
var status =true;
if (joinidv!=8){
    if(username.length == 0){
        ds.dialog({
            title : '&#25805;&#20316;&#25552;&#31034;',
            content : '&#35831;&#36755;&#20837;{$config['nametext']}',
            yesText : '&#30830;&#23450;',
            timeout :2.5,
        });
        return false;
    }
    status = checkmobile(mobile,mobiletips);
    if (!status){return false;}
}

if(datetimetips) {
    if (datetimetype == 6) {
        status = checkmobile(datetime,datetimetips);
        if (!status){return false;}
    }else if (datetime.length <= 0) {
        ds.dialog({
            title: '&#25805;&#20316;&#25552;&#31034;',
            content:  datetimetips,
            yesText: '&#30830;&#23450;',
            timeout: 2.5,
        });
        return false;
    }
}


if(addresstips) {
    if (addresstype == 6) {
        status = checkmobile(address,addresstips);
        if (!status){return false;}
    }else if (address.length <= 0 ) {
        ds.dialog({
            title: '&#25805;&#20316;&#25552;&#31034;',
            content: addresstips,
            yesText: '&#30830;&#23450;',
            timeout: 2.5,
        });
        return false;
    }
}
if(formtwotips) {
    if (formtwotype == 6) {
        status = checkmobile(formtwo,formtwotips);
        if (!status){return false;}
    }else if (formtwo.length <= 0 ) {
        ds.dialog({
            title: '&#25805;&#20316;&#25552;&#31034;',
            content: formtwotips,
            yesText: '&#30830;&#23450;',
            timeout: 2.5,
        });
        return false;
    }
}

if(addinfotips) {
    if (addinfotype == 6) {
        status = checkmobile(addinfo,addinfotips);
        if (!status){return false;}
    }else if (addinfo.length <= 0) {
        ds.dialog({
            title: '&#25805;&#20316;&#25552;&#31034;',
            content: addinfotips,
            yesText: '&#30830;&#23450;',
            timeout: 2.5,
        });
        return false;
    }
}

if(shopstips){
    if (shopstype == 6) {
        status = checkmobile(option,shopstips);
        if (!status){return false;}
    }else if(option.length <=0){
      ds.dialog({
        title : '&#25805;&#20316;&#25552;&#31034;',
        content : shopstips,
        yesText : '&#30830;&#23450;',
          timeout :2.5,
      });
      return false;
    }
}
if(xieyitips){
    if(!xieyi){
        ds.dialog({
            title : '&#25805;&#20316;&#25552;&#31034;',
            content : '&#35831;' + xieyitips,
            yesText : '&#30830;&#23450;',
            timeout :2.5,
        });
        return false;
    }
}
